package com.cqjtu.drive.controller;

import com.cqjtu.drive.pojo.User;
import com.cqjtu.drive.response.Response;
import com.cqjtu.drive.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author zxl
 * @Date 2024/6/14 9:06
 */

@RestController
public class UserController {
    @Autowired
    UserService userService;

        @PostMapping("/api/user/register")
    public Response<User> register(@RequestBody Map<String,String> map){return userService.register(map);}

    @PostMapping("/api/user/login")
    public Response<User> login(@RequestParam String userName,@RequestParam String passWord){return userService.login(userName,passWord);}

    @PostMapping("/api/user/getByAccount")
    public Response<User> getByAccount(@RequestParam String userAccount){
        return userService.getByAccount(userAccount);
    }
}
